﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace LowLevelGraphics.ImageFormats.SVG.Shapes
{
    /// <summary>
    /// 
    /// </summary>
    public class Polyline : Shape
    {
        protected List<PointD> m_aPoint = new List<PointD>();


        /// <summary>
        /// Initializes a new instance of the <see cref="Polyline"/> class.
        /// </summary>
        public Polyline()
        {
        }

        /// <summary>
        /// Gets or sets the points.
        /// </summary>
        /// <value>The points.</value>
        public List<PointD> Points
        {
            get { return m_aPoint; }
            set { m_aPoint = value; }
        }

        /// <summary>
        /// Draws the specified g.
        /// </summary>
        /// <param name="g">The g.</param>
        public override void Draw(System.Drawing.Graphics g)
        {
            List<Point> aPoint = new List<Point>();
            foreach (PointD point in this.m_aPoint)
            {
                aPoint.Add(Point.Ceiling(PointD.Ceiling(point)));
            }

            Brush brush = new SolidBrush(Style.StrokeColor);
            Pen pen = new Pen(brush, Style.StrokeWidth);
            g.DrawLines(pen, aPoint.ToArray());
            pen.Dispose();
            brush.Dispose();
        }
    }
}
